
#include "time_n_date.h"
#include "custom_string.h"

//kamus
string s,l,m,n;
Time t,r;
boolean b;
Date d,e;
//algoritma
int main()
{
	s = CharToString("2-2-1992");
	l = CharToString("02:10:30");
	
	printf ("ini masi string\n");
	printf("%s\n",s.s);
	printf("%s\n",l.s);

	printf("ini sudah dalam date\n");
	t = ParseTime(l);
	printf("%02d,%02d,%02d \n", (t.h),(t.m),(t.s));
	d = ParseDate(s);
	printf("%02d,%02d,%02d \n", (d.d),(d.m),(d.y));

	printf("balik ke string\n");	
	m = DateToString(d);
	printf("%s \n", m.s);
	n = TimeToString(t);
	printf("%s \n", n.s);


	e.y = 1991;	e.m = 02;
	e.d = 01;	r.h = 12;
	r.m = 12;	r.s = 2;
	printf("\ntime1 = 02:10:30");
	printf("\ntime2 = 12:12:02\n");

	b = IsTimeLt(t,r);
	printf("time1 < time2 = %d \n", b);
	b = IsTimeGt(t,r);
	printf("time1 > time2 = %d \n", b);
	b = IsTimeEq(t,r);
	printf("time1 = time2 = %d \n", b);

	printf("\ndate1 = 2-2-1992");
	printf("\ndate2 = 1-2-1991\n");

	b = IsDateLt(d,e);
	printf("date1 < date2 = %d \n", b);
	b = IsDateGt(d,e);
	printf("date1 > date2 = %d \n", b);
	b = IsDateEq(d,e);
	printf("date1 = date2 = %d \n", b);
	d = GetCurrentDate();
	printf("Sekarang tanggal : %02d-%02d-%d \n", d.d,d.m,d.y);
	t = GetCurrentTime();
	printf("Sekarang jam     : %02d:%02d:%02d \n", t.h,t.m,t.s);
	return 0;
}
